package com.job.yangshida.homework0715;

/**
 * @author 杨士达
 * @version 1.0
 * @since 2022-07-16 13:16:43
 */
public class String04 {
    //求字符串里连续出现次数最多的字符,和他连续出现的次数
    public static void main(String[] args) {
        int max=1;//zuidacishu最大次数
        int count=1;//每个字符连续出现的次数
        char c=' ';
        String s="11aaaaa254682qqqqqqqqq";
        for (int i=0;i<s.length()-1;i++){
            if (s.charAt(i)==s.charAt(i+1)){
                count++;
            }else {
                if (max<count){
                    max=count;
                    c=s.charAt(i);
                }
                count=1;
            }
        }
        if (max<count){
            max=count;
            c=s.charAt(s.length()-1);}
        System.out.println(c+"***"+max);

    }
}
